<div class="form">

<script type="text/javascript" language="javascript">
	$(document).ready(function () {
		window.onload=function(){
			$('#select_div').hide();
		}
		
		$('#qual_type').change(function() {
			var selected = $('#EduHigherQual_qual_type').val();
			
			if(selected == ''){
			  $('#select_div').hide();
			}
			else{
			  $('#select_div').show();
			}
		});
	});
</script>

<script type="text/javascript" language="javascript">
	$(document).ready(function() {
		$("#EduHigherQual_option_0").click(function() {
			if($(this).val() == 1){
				$('#percentage').show();
				$('#grade').hide();
			}
		});
		$("#EduHigherQual_option_1").click(function() {
			if($(this).val() == 2){
				$('#grade').show();
				$('#percentage').hide();
			}
		});
	});
</script>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'edu-higher-qual-higher_qualification_form-form',
	'enableAjaxValidation'=>false,
	'enableClientValidation'=>true,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
	
	<?php $rangeYear = ApplicationConfig::app()->params['scaling_params']['yearOfPassing']; ?>

	<div class="row" id="qual_type">
		<?php echo $form->labelEx($model,'qual_type'); ?>
		<?php echo $form->dropDownList($model,'qual_type',ApplicationConfig::app()->params['scaling_params']['qualType'],array('empty' => 'Select Qualification Type')); ?>
		<?php echo $form->error($model,'qual_type'); ?>
	</div>
	
	<div id="select_div">
	
		<input type="hidden" id="EduHigherQual_college_name_hidden" name="EduHigherQual_college_name_hidden" value="">
	
		<div class="row">
			<?php echo $form->label($model,'collegeID'); ?>
			
			<?php
				$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
		     			'name'=>'EduJrcollege[college_name]',
		      			'id'=>'EduHigherQual_college_name',
					'value'=>'',
		      		'source'=>'js: function(request, response) {
		   			 $.ajax({
		        		url: "'.$this->createUrl('/user_register/SecondRegister/GetCollegeName').'",
		        		dataType: "json",
		        		data: {
		           		term: request.term,
		           		state: $("#job_location_stateID_hidden").val(),           				
		        		},
		        		success: function (data) {
		              		response(data);
		        			}
		    			})
		 			}',
					//$this->createUrl('search/searchloc'),
		     			'options'=>array(
		                	'showAnim'=>'fold',
					'minLength'=>'2',
		                	'select'=> 'js:function(event, ui) {
		                	$("#EduHigherQual_college_name").val(ui.item.value);
		                	$("#EduHigherQual_college_name_hidden").val(ui.item.id);
		                	
		                	}'
					),
		                	'htmlOptions'=>array('size'=>'40','class'=>'restaurant'),      
				 ));
						
				Yii::app()->clientScript->registerScript('custom_loc_search1','	
			    $("#EduHigherQual_college_name").data( "autocomplete" )._renderItem = function( ul, item ) {
			    		return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a><h6>" + item.value + "</h6></a>" ) .appendTo(ul);
			 		
				};');
			?>
		</div>
	
		<div class="row" id="option">
			<?php echo $form->labelEx($model,'option'); ?>
			<?php echo $form->radioButtonList($model,'option', array('1' => 'percentage', '2' => 'grade')); ?>
			<?php echo $form->error($model,'option'); ?>
		</div>
		
		<div class="row" style="display:none" id="percentage">
			<?php echo $form->labelEx($model,'percentage'); ?>
			<?php echo $form->textField($model,'percentage'); ?>
			<b>%</b>
			<?php echo $form->error($model,'percentage'); ?>
		</div>
		
		<div class="row" style="display:none" id="grade">
			<?php echo $form->labelEx($model,'grade'); ?>
			<?php echo $form->textField($model,'grade'); ?>
			<?php echo $form->error($model,'grade'); ?>
		</div>

		<div class="row">
			<?php echo $form->labelEx($model,'year_passing'); ?>
			<?php echo $form->dropDownList($model,'year_passing',ApplicationConfig::getYearValue($rangeYear['startYear'],$rangeYear['endYear']), array('empty' => 'Select a Year')); ?>
			<?php echo $form->error($model,'year_passing'); ?>
		</div>

		<div class="row">
			<?php echo $form->labelEx($model,'course_name'); ?>
			<?php echo $form->textArea($model,'course_name', array('maxlength' => 300)); ?>
			<?php echo $form->error($model,'course_name'); ?>
		</div>

		<div class="row">
			<?php echo $form->labelEx($model,'type'); ?>
			<?php echo $form->dropDownList($model,'type',ApplicationConfig::app()->params['scaling_params']['highGradType'],array('empty' => 'Select Course Type')); ?>
			<?php echo $form->error($model,'type'); ?>
		</div>

		<div class="row">
			<?php echo $form->labelEx($model,'specilization'); ?>
			<?php echo $form->textField($model,'specilization'); ?>
			<?php echo $form->error($model,'specilization'); ?>
		</div>

		<div class="row">
			<?php echo $form->labelEx($model,'university'); ?>
			<?php echo $form->dropDownList($model,'university',ApplicationConfig::app()->params['scaling_params']['highGradUniversity'],array('empty' => 'Select University')); ?>
			<?php echo $form->error($model,'university'); ?>
		</div>
		
		<div class="row">
			<?php echo $form->labelEx($model,'status'); ?>
			<?php echo $form->dropDownList($model,'status',ApplicationConfig::app()->params['vendor_params']['status'], array('empty' => 'Select Status')); ?>
			<?php echo $form->error($model,'status'); ?>
		</div>

	</div>	

		<div class="row buttons">
			<?php echo CHtml::submitButton('Submit'); ?>
			<?php echo CHtml::link('Skip',ApplicationConfig::getURL("user_register", "secondRegister", "eduAdditionalQualification"),array()); ?>
		</div>
	
<?php $this->endWidget(); ?>

</div><!-- form -->